#!/bin/bash

function_name=$1

# 在源代码中查找函数的定义
definition=$(grep -n "^[ \t]*[a-zA-Z_][a-zA-Z0-9_]*[ \t]*$function_name[ \t]*([^)]*)[ \t]*{.*$" source/*.cpp source/*.h)

# 在源代码中查找函数的声明
declaration=$(grep -n "^[ \t]*[a-zA-Z_][a-zA-Z0-9_]*[ \t]*$function_name[ \t]*([^)]*)[ \t]*;.*$" source/*.cpp source/*.h)

echo "Function $function_name Definition:"
echo "$definition"

echo "Function $function_name Declaration:"
echo "$declaration"
